<!DOCTYPE html>
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>FStack-我的订单</title>    
	<link rel="stylesheet" type="text/css" href="./css/style.css">
    <link rel="stylesheet" href="./css/order.css">
	<style type="text/css">
		
	</style>
    </head>
	<body style="">
	  <div class="wrapper">
  	  <div class="page-header clearfix">
        <div class="middle-nav">
          <div class="middlenav-wrap clearfix">
            <h1 class="logo fl">
              <a href="/front/goods.html" title="FStack"><img src="./images/logo.png" alt="FStack"></a>
            </h1>
			<div class="desire fl">
              <span id="memberName" style="font-size:16px;">欢迎您,</span>
              <a href="/front/order_list.html" class="ca-lightgrey" rel="nofollow"><span>我的订单</span></a>
              <a href="/front/order_detail.html" class="ca-lightgrey" rel="nofollow"><span>我的购物车</span></a>
              <!-- <a href="/order_list.html" class="ca-lightgrey" rel="nofollow"><span>待派送</span></a> -->
            </div>
          </div>
        </div>
      </div>
      <div class="page-wrap">
        <div class="inner-wrap">
			<div class="orders">
				<div id="order_list" class="orders-body">
					
				</div>
				<!-- 分页 -->
				<!-- <div class="btn-box"><a class="left-arrow iconfont icon-btn_left "></a><a class="right-arrow iconfont icon-btn_right "></a></div> -->
			</div>
		</div>
    </div>
  </div>
  
   <!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../static/h-ui.admin/js/common.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/utils.js"></script>
<script type="text/javascript">
$(function(){
	loadData();
});
//加载数据
function loadData(){
	$("#memberName").html($("#memberName").html()+common.currentMember.name);
	
	var url = "/order/list?pageNum=-1";
	common.getData(url,function(data){
		var list = data.result.records;
		var html="";
		for(var i=0;i<list.length;i++){
			var obj = list[i];
			html+='<div>\
					<div class="order-item clearfix">\
						<div class="order-img"><a href="" class="link" target="_blank">'+obj.orderTime+'</a></div>\
						<div class="order-info"><div class="info-box"><a href="" class="link" target="_blank">\
							<p class="order-title">'+obj.number+'</p></a>\
							<p class="info" title="'+obj.extraData.details+'">'+common.stringLengthUtils(80,obj.extraData.details)+'</p>\
						</div>\
						</div>\
						<div class="order-price">\
							总价: ￥'+obj.total+'<br>\
							数量：'+obj.persons+'</div>\
						<div class="order-status">'+obj.statusDis+'</div>\
						<div class="order-btn">'+statusUtils(obj)+'</div>\
					</div>\
				</div>';
		}
		$("#order_list").html(html);
	});
}
function statusUtils(obj){
	var s = ""; 
	if(obj.status==0){
		s = '<a title="取消订单" href="javascript:;" onclick="editStatus(\''+obj.id+'\',\'6\')" class="ml-5" style="text-decoration:none">取消订单</a>';
	}
	return s;
}
//修改订单状态
function editStatus(id,status){
	var url = "/order/editStatusById";
	var data={id:id,status:status};
	common.postData(url,data,function(data){
		common.msg(data.msg);
		loadData();
	});
}
</script>
</body>
</html>